<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>姓名案例_插值语法实现</title>
    <script src="../js/vue.js"></script>
</head>
<body>
    <div id="root">
        姓:<input type="text" v-model="firstName"></input><br><br>
        名:<input type="text" v-model="lastName"></input><br><br>
        全名:<span>{{firstName.slice(0,3)}}-{{lastName}}</span>
        <!-- 这里如果 需求时截取三位，或者又反转字符串又转换为大写等等，{{}}中就会很复杂不便于阅读 -->
        <!-- 使用methods解决 见2_methods实现.html -->
    </div>
    <script>
        Vue.config.productionTip = false;

        new Vue({
            el:'#root',
            data:{
                firstName:'张',
                lastName:'三'
            }
        })

    </script>
</body>
</html>